import unittest
from XTestRunner import HTMLTestRunner


class TestSuite:

    # 传一个测试生成测试套件
    def test_class_suite(self, testcase):
        suite = unittest.defaultTestLoader.loadTestsFromTestCase(testcase)
        return suite

    def send_html(self, suite):
        with open('test.html', 'wb') as f:
            runner = HTMLTestRunner(stream=f, title='测试报告', language='zh-CN')
            runner.run(suite)
